//
// Created by ckxgz on 2021/6/3.
//

#include <iostream>
#include <vector>

using namespace std;

// 是否传递
bool is_transitive(vector<vector<int> > v)
{
    int t = v.size();
    for (int i = 0; i < t; ++i) {
        for (int j = 0; j < t; ++j) {
            if(j == i) continue;
            for (int k = 0; k < t; ++k) {
                if (k == j || k == j) continue;
                if(v[i][j] && v[j][k]) {
                    if (!v[i][k]) return false;
                }
            }
        }
    }
    return true;
}

int main()
{
    int n;
    cin>>n;
    vector<vector<int> > v(n);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            int t;
            cin>>t;
            v[i].push_back(t);
        }
    }
    if(is_transitive(v)) cout<<"The matrix is transitive."<<endl;
    else cout<<"The matrix is not transitive."<<endl;
    return 0;
}